<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('通知公告列表')"/>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <li>
                            <label>公告标题：</label>
                            <input type="text" name="gonggaobiaoti"/>
                        </li>
                        <li>
                            公告类型：<select name="gonggaoleixing" th:with="type=${@dict.getType('sys_gonggao_type')}">
                            <option value="">所有</option>
                            <option th:each="dict : ${type}" th:text="${dict.dictLabel}"
                                    th:value="${dict.dictValue}"></option>
                        </select>
                        </li>
                        <li>
                            公告状态：<select name="gonggaozhuangtai" th:with="type=${@dict.getType('sys_gonggao_status')}">
                            <option value="">所有</option>
                            <option th:each="dict : ${type}" th:text="${dict.dictLabel}"
                                    th:value="${dict.dictValue}"></option>
                        </select>
                        </li>
                        <li>
                            <label>发布时间：</label>
                            <input type="text" class="time-input" placeholder="请选择发布时间" name="fabushijian" />
                        </li>

                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                    class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="btn-group-sm" id="toolbar" role="group">
            <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:gonggao:add">
                <i class="fa fa-plus"></i> 添加
            </a>
            <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()"
               shiro:hasPermission="system:gonggao:remove">
                <i class="fa fa-remove"></i> 删除
            </a>
        </div>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('system:gonggao:edit')}]];
    var removeFlag = [[${@permission.hasPermi('system:gonggao:remove')}]];
    var types = [[${@dict.getType('sys_gonggao_type')}]];
    var datas = [[${@dict.getType('sys_gonggao_status')}]];
    var prefix = ctx + "system/gonggao";


    $(function () {
        function bootstrapTableFieldCellStyle() {
            return {
                css: {
                    "max-width": "300px" ,
                    "white-space": "nowrap" ,
                    "text-overflow": "ellipsis" ,
                    "overflow": "hidden" ,
                }
            };
        }

        var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "通知公告",
                showSearch:false,
                showRefresh:false,
                showColumns:false,
                showToggle:false,
                columns: [{
                    checkbox: true
                },
                    {
                        field: 'gonggaoid',
                        title: '公告ID',
                        visible: false
                    },
                    {
                        field: 'gonggaobiaoti',
                        title: '公告标题'
                    },
                    {
                        field: 'gonggaoleixing',
                        title: '公告类型',
                        align: 'center',
                        sortable: true,
                        formatter: function (value, row, index) {
                            return $.table.selectDictLabel(types, value);
                        }
                    },
                    {
                        field: 'gonggaozhuangtai',
                        title: '公告状态',
                        align: 'center',
                        formatter: function (value, row, index) {
                            return $.table.selectDictLabel(datas, value);
                        }
                    },
                    {
                        field: 'beizhu1',
                        title: '是否置顶',
                        align: 'center',
                        formatter: function (value, row, index) {
                            if(value=="1")return "置顶"
                            if(value=="0")return "不置顶"}
                    },
                    /*                {
                                        field: 'chuangjianrenid',
                                        title: '创建人ID',
                                    },*/
                    {
                        field: 'chuangjianren',
                        title: '创建人'
                    },
                    /*                {
                                        field: 'chuangjianshijian',
                                        title: '创建时间',
                                        sortable: true,

                                    },*/
                    /*                {
                                        field: 'jieshourenid',
                                        title: '接收人ID',

                                    },*/
                    {
                        field: 'jieshouren',
                        title: '接收人',
                        cellStyle: bootstrapTableFieldCellStyle,
                    },
                    {
                        field: 'fabushijian',
                        title: '发布时间',
                        sortable: true,
                    },
                    /*                {
                                        field: 'shifouyuedu',
                                        title: '是否阅读',
                                        sortable: true,

                                    },*/
                    /*                {
                                        field: 'beizhu1',
                                        title: '备注1'
                                    },
                                    {
                                        field: 'beizhu2',
                                        title: '备注2'
                                    },
                                    {
                                        field: 'beizhu3',
                                        title: '备注3'
                                    },
                                    {
                                        field: 'beizhu4',
                                        title: '备注4'
                                    },
                                    {
                                        field: 'beizhu5',
                                        title: '备注5'
                                    },
                                    {
                                        field: 'isvalid',
                                        title: '是否有效'
                                    },*/
                    {
                        title: '操作',
                        align: 'center',
                        formatter: function
                            (value, row, index) {
                            var actions = [];
                            actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.gonggaoid + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                            actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.gonggaoid + '\')"><i class="fa fa-remove"></i>删除</a>');
                            return actions.join('');
                        }
                    }]
            }
        ;

        $.table.init(options);
    });
</script>
</body>
</html>